def main():
    lst=[int(i) for i in input().split()]
    key=int(input())
    lst.sort()
    print(lst)
    print(binarysearch(lst,key))
def binarysearch(lst,key):
    low=0
    high=len(lst)-1
    count=0
    while high>=low:
        mid=(low+high)//2
        count+=1
        if key<lst[mid]:
            high=mid-1
        elif key==lst[mid]:
            return mid,count
        else:
            low=mid+1
        print(lst[low:high+1])
    return -1,count
main()

